Skip to content

Conversation

@handje
Copy link
Collaborator

@handje handje commented Feb 10, 2025

Pull request

Related issue

Resolve #173 @handje

Motivation and context

  1. 헤더에 로그인버튼 추가

Solution

  1. FSD원칙에 따라 shared에서는 상위 폴더를 사용할수없기에 popover 컴포넌트는 features로 이동하였습니다.
  2. ui요소는 features가 적합하다고 생각하여 , features에 구현하였습니다. 실제 model에 관련한 로직과 entity는 entities폴더에 구현할 예정입니다.
  3. features/auth : 로그인 관련 ui , features/user : 유저 프로필 관련 ui
📂 auth
 └── 📂 ui
      ├── auth-wrapper.tsx
      ├── index.ts
      ├── login-button.tsx
      └── logout-button.tsx
📂 user
 └── 📂 ui
      ├── index.ts
      ├── profile-nickname.tsx
      ├── profile-picture.tsx
      ├── profile-popover-content.tsx
      └── profile-popover.tsx
  1. 로그인 뷰는 따로 없이 login버튼 클릭 시, 카카오 로그인 리다이렉션으로 이동할 예정입니다.
  2. Header컴포넌트를 불러오는 layout에서 user여부에 따라 컴포넌트를 렌더링합니다.
 <Header authContent={user ? <ProfilePopover /> : <LoginButton />} />
  1. user는 zustand로 관리될 예정입니다. 임시로 Login버튼이 보이도록 null처리 해두었습니다. user={}로 할 경우, 기존 popover가 보여집니다.
  2. 메인페이지 외에는 로그인이 안될 경우 접근할 수 없도록 redirect처리하였습니다. 리다이렉트전에 화면 깜빡임이 생기는것은 실제 user 상태 추가 후에 리팩토링 할 예정입니다.
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
  const pathname = usePathname();
  const router = useRouter();
  const user = null;

  useEffect(() => {
    if (!user && pathname !== '/') {
      router.push('/');
    }
  }, [user, pathname]);

  return <>{children}</>;
};
export default AuthWrapper;

...

<AuthWrapper> {children}</AuthWrapper>

How has this been tested

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the docs/CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@handje handje requested a review from KimKyuHoi February 10, 2025 13:55
@handje handje self-assigned this Feb 10, 2025
@netlify
Copy link

netlify bot commented Feb 10, 2025

Deploy Preview for jootalkpia ready!

Name Link
🔨 Latest commit 1d43bac
🔍 Latest deploy log https://app.netlify.com/sites/jootalkpia/deploys/67aa056b22fc8400081e07cb
😎 Deploy Preview https://deploy-preview-179--jootalkpia.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@handje handje added ✨ Feature 기능 추가 💄 Design 프론트엔드 CSS 관련 이슈 🖥️ FE 프론트엔드 ♻️ Need To Refactor 추후 리팩토링이 필요한 이슈 및 논의 무조건 스프린트내에 해야하는 것들 labels Feb 10, 2025
@handje handje added this to the 주톡피아 마일스톤2 milestone Feb 10, 2025
@handje handje removed the request for review from KimKyuHoi February 11, 2025 05:13
@handje
Copy link
Collaborator Author

handje commented Feb 11, 2025

잠시 보류하겠습니다! 로그인 페이지가 제일 처음에 구현되야할지 백엔드와 논의 후, 결정하겠습니다 @KimKyuHoi

Copy link
Collaborator

@KimKyuHoi KimKyuHoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 좋습니다. 현재 제가 fetch-instance를 수정했는데 조금있다 올리겠습니다!

@handje
Copy link
Collaborator Author

handje commented Feb 11, 2025

오호 좋습니다. 현재 제가 fetch-instance를 수정했는데 조금있다 올리겠습니다!

우선 merge하겠습니다. 로그인 페이지가 생성된다면 login버튼은 삭제될수있습니다.

@handje handje merged commit 372ad64 into dev Feb 11, 2025
6 checks passed
@handje handje deleted the fe-feat/login-layout branch February 11, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💄 Design 프론트엔드 CSS 관련 이슈 🖥️ FE 프론트엔드 ✨ Feature 기능 추가 ♻️ Need To Refactor 추후 리팩토링이 필요한 이슈 및 논의 무조건 스프린트내에 해야하는 것들

Projects

None yet

Development

Successfully merging this pull request may close these issues.

로그인 레이아웃 구현

3 participants